package com.creditease.rss.ui;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ViewSwitcher;

public class RssImageSwitcher extends ViewSwitcher {

    private Context context;

    public RssImageSwitcher(Context context) {
	super(context);
	this.context = context;
    }

    public RssImageSwitcher(Context context, AttributeSet attrs) {
	super(context, attrs);
	this.context = context;
    }

    public void setImageDrawable(Bitmap drawable, int imageWidth,
	    int imageHeight) {
	MyImageView image = (MyImageView) this.getNextView();
	image.setImageWidth(imageWidth);
	image.setImageHeight(imageHeight);
	image.setImageBitmap(drawable);
	showNext();
    }

    public View getSelectedView() {
	return getCurrentView();
    }

    /*
     * ViewFactory mFactory;
     * 
     * @Override public void setFactory(ViewFactory factory) { mFactory =
     * factory; obtainView(); obtainView(); }
     * 
     * private View obtainView() { View child = mFactory.makeView();
     * LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp == null)
     * { lp = new LayoutParams(LayoutParams.MATCH_PARENT,
     * LayoutParams.WRAP_CONTENT); } addView(child, lp); return child; }
     */

}
